package com.xialinrui.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xialinrui.dto.DailyAcquirementDto;
import com.xialinrui.dto.MonthlyAcquirementDto;
import com.xialinrui.dto.YearlyAcquirementDto;
import com.xialinrui.entity.Acquirement;
import com.xialinrui.mapper.AcquirementMapper;
import com.xialinrui.service.AcquirementService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xialinrui
 */
@Service
public class AcquirementServiceImpl extends ServiceImpl<AcquirementMapper, Acquirement> implements AcquirementService {
    @Resource
    private AcquirementMapper acquirementMapper;

    @Override
    public void increaseAcquire(Long todoId, Long affairId) {
        acquirementMapper.increaseAcquire(todoId, affairId);
    }

    @Override
    public Double getMoneyNumbersTodayByAffairId(Long affairId) {
        return acquirementMapper.getMoneyNumbersToday(affairId);
    }

    @Override
    public Integer getLoveNumbersTodayByAffairId(Long affairId) {
        return acquirementMapper.getLoveNumbersToday(affairId);
    }

    @Override
    public void decreaseAcquire(Long id) {
        acquirementMapper.decreaseAcquire(id);
    }

    @Override
    public void addAcquireByAffairIdAndTime(Long id, Integer realTime) {
        acquirementMapper.addAcquireByAffairIdAndTime(id, realTime);
    }

    @Override
    public Integer getDailyStudyTime(Long id, Integer realTime) {
        acquirementMapper.updateDailyTime(id, realTime);
        return acquirementMapper.getDailyStudyTime(id);
    }

    @Override
    public void add(Acquirement acquirement) {
        acquirementMapper.insert(acquirement);
    }

    @Override
    public List<MonthlyAcquirementDto> thingsMonthly(String from, String to) {
        return acquirementMapper.thingsMonthly(from,to);
    }

    @Override
    public List<DailyAcquirementDto> thingsDaily(String from, String to) {

        return acquirementMapper.thingsDaily(from,to);

    }

    @Override
    public List<YearlyAcquirementDto> thingsYearly(String from, String to) {
        return acquirementMapper.thingsYearly(from,to);
    }


}
